import { request } from 'ice';
import type { CategoryItem } from './data';

export const categoryApi = {
  // 获取分类列表
  getList: (data: any) => {
    return request({
      method: "GET",
      params: data,
      url: "/categories/list",
    });
  },

  // 创建分类
  create: (data: CategoryItem) => {
    return request({
      method: "POST",
      data,
      url: "/categories/create",
    });
  },

  // 更新分类
  update: (data: CategoryItem) => {
    return request({
      method: "POST",
      data,
      url: "/categories/update",
    });
  },

  // 删除分类
  delete: (id: string | number) => {
    return request({
      method: "POST",
      data: { id },
      url: "/categories/delete",
    });
  },
}; 